<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
// To verify "mac" behavior other than macOS, please add following lines:
//   internals.settings.setEditingBehavior('mac');
//   internals.settings.setSelectTrailingWhitespaceEnabled(false);
const isMac = navigator.platform.indexOf('Mac') === 0;

selection_test(
  '<div contenteditable dir="rtl">|abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">|abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-0 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">a|bc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">|abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-1 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">ab|c \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">|abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-2 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc| \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">|abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-3 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc |\u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">|abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-4 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0|\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc |\u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-5 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0|\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc |\u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-6 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0| hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc |\u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-7 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 |hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc |\u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-8 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 h|ij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 |hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-9 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hi|j \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 |hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-10 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij| \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 |hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-11 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij |\u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 |hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-12 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0|\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij |\u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-13 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0|\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij |\u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-14 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0| xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij |\u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-15 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 |xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij |\u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-16 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 x|yz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 |xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-17 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xy|z<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 |xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-18 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz|<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 |xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-19 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz|<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 |xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-20 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br>|<br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz|<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-21 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br>|<br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br>|<br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-22 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>|\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br>|<br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-23 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0|\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>|\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-24 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0|\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>|\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-25 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0| kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>|\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-26 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 |kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>|\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-27 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 k|j \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 |kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-28 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj| \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 |kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-29 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj |\u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 |kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-30 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0|\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj |\u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-31 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0|\u05D0 opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj |\u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-32 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0| opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj |\u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-33 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 |opq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj |\u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0</div>',
  '5-34 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 o|pq \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 |opq \u05D0\u05D0\u05D0</div>',
  '5-35 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 op|q \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 |opq \u05D0\u05D0\u05D0</div>',
  '5-36 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq| \u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 |opq \u05D0\u05D0\u05D0</div>',
  '5-37 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq |\u05D0\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 |opq \u05D0\u05D0\u05D0</div>',
  '5-38 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0|\u05D0\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq |\u05D0\u05D0\u05D0</div>',
  '5-39 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0|\u05D0</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq |\u05D0\u05D0\u05D0</div>',
  '5-40 rtl right word');

selection_test(
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq \u05D0\u05D0\u05D0|</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl">abc \u05D0\u05D0\u05D0 hij \u05D0\u05D0\u05D0 xyz<br><br><br>\u05D0\u05D0\u05D0 kj \u05D0\u05D0\u05D0 opq |\u05D0\u05D0\u05D0</div>',
  '5-41 rtl right word');
</script>
